/**
 * Food 食物类
 */

 class Food {
    constructor(rows = 10, cells = 10, colors = ['red', 'blue', 'yellow', 'pink']) {
        this.rows = rows;
        this.cells = cells;
        this.colors = colors;
        this.data = null;
    }
    create() {
        const x = Math.floor(Math.random() * this.rows);
        const y = Math.floor(Math.random() * this.cells);
        const color = this.colors[parseInt(Math.random() * this.colors.length)];
        this.data = {
            x,
            y,
            color
        };
       
    }
}

export default Food;